function getNowFormatDate() {
    var date = new Date();
    var seperator1 = "-";
    var seperator2 = ":";
    var month = date.getMonth() + 1;
    var strDate = date.getDate();
    if (month >= 1 && month <= 9) {
        month = "0" + month;
    }
    if (strDate >= 0 && strDate <= 9) {
        strDate = "0" + strDate;
    }

    // 当前的年月日
    var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate;

    // 当前的年月日时分秒
    // var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
    //     + " " + date.getHours() + seperator2 + date.getMinutes()
    //     + seperator2 + date.getSeconds();
    return currentdate;
}


function mayGetMoney() {
    var firstDate = new Date();
    firstDate.setDate(1); //第一天


    var nowData = getNowFormatDate(); // now data
    var endADateStr = nowData;

    var mothonFrist = new XDate(firstDate).toString('yyyy-MM-dd'); // mothon first

    var beginTimeStr = mothonFrist;


    var newTime = timeAll();
    var timestamp = 'timeStamp:' + newTime + 'BM' + 'pageNum:' + 1 + 'BM' + 'pageSize:' + 100 + 'BM' + 'tradeFlag:' + '' + 'BM' + 'startDate:' + beginTimeStr + 'BM' + 'endDate:' + endADateStr + 'BM';
    var signs = md5(timestamp);
    signs = signs.toUpperCase();
    // 发送请求
    $.ajax({
        type: 'get',
        url: webUrl + '/mywallet/getAccountList',
        data: {
            'timeStamp': newTime,
            'sign': signs,
            'pageNum': 1,
            'pageSize': 100,
            'tradeFlag': '',
            'startDate': beginTimeStr,
            'endDate': endADateStr,
        },
        dataType: 'JSON',
        async: false,
        success: function (data) {
            console.log(data)
            if (data.status == 200) {
                // 拼接字符串
                var item = data.data;
                //  收入
                $('#income').html(item.incomeAmount)
                //  支出
                var expenditureAmount = item.expenditureAmount.toString().replace('-', '')
                $('#expenditure').html(expenditureAmount)
                //  如果返回订单为空；弹出DOC
                if (item.detailList.length == 0) {
                    alert('您目前没有查看的账单');
                } else {
                    var item = item.detailList;
                    // var no = '未知';
                    // console.log(item,'=====')
                    //  订单信息 后端返回的数据
                    var detaiStr;
                    for (var i = 0; i < item.length; i++) {
                        if (item[i].orderId != '') {
                            var detaiStr =
                                '<div class="detsilAccount row">' +
                                '<div class="left">' +
                                '<p class="time">' + item[i].tradeDate + '</p>' +
                                '<p class="productName">' + item[i].productName + '</p>' +
                                '<p class="orderID">' + '订单号：' + item[i].orderNum + '</p>' +
                                '</div>';

                            var rightStr =
                                '<div class="right">' +
                                '<span class="siteDetail">' + item[i].tradeType + '</span>' +
                                '<span class="green">' + item[i].amount + '</span>' +
                                '<div>' +
                                '<span class="site">预估价</span>' +
                                '<span class="gray">' + item[i].tempAmount + '</span>' +
                                '</div>' +
                                '</div>';
                            detaiStr = detaiStr + rightStr;
                            var imgStr =
                                '<div class="rightSkip">' +
                                '<img src="../imges/rightArrow.png" alt="" onclick=skipBillDetail(\"' + item[i].orderId + '\")>' +
                                '</div>' +
                                '</div>'

                            detaiStr = detaiStr + imgStr;

                        } else if (item[i].orderId == '') {
                            detaiStr = '<div class="detsilAccount row">' +
                                    '<div class="left">' +
                                    '<p class="time">'+item[i].tradeDate+'</p>' +
                                    '<p class="productName">'+item[i].tradeType+'</p>' +
                                    '</div>' +
                                    '<div class="right">' +
                                    '<p class="getGreen">'+item[i].amount+'</p>' +
                                    '</div>' +
                                    '</div>';
                        }
                        $('#accountMain').append(detaiStr);

                    }
                }
            }
        }
    })
}
function skipBillDetail(orderId) {
    document.location.href = './billDetails.html?orderId='+orderId;
    // document.location.href = './billDetails.html'+'?'+"orderId="+data;
}